{extend name="public:base" /}

{block name="left_nav"}
<div class="lb-nav">
    <a href="javascript: void(0)" class="lbn-btn active">学习记录</a>
    <a href="{:url('integralLogList')}" class="lbn-btn">我的积分</a>
    <a href="{:url('errorTopicList')}" class="lbn-btn">错题本</a>
    <a href="{:url('weChatList')}" class="lbn-btn">微信讨论群</a>
</div>{/block}

{block name="main"}
<div class="mid-box" style="width: calc(100% - 300px);">

    <div class="mb-title">
        <div class="mbt-bt">学习记录</div>
        <div class="mbt-r">
            <input type="text" placeholder="请输入学习点名称" class="mbtr-wb knowledge_name" value="{:input('knowledge_name')}">
            <button class="mbtr-btn">搜索</button>
            <div class="divclear"></div>
        </div>
        <div class="divclear"></div>
    </div>

    <div class="mb-table">

        <table width="100%" border="0">
            <thead>
            <tr>
                <th scope="col" width="40%">学习点</th>
                <th scope="col" width="40%">最新学习时间</th>
                <th scope="col" width="20%">操作</th>
            </tr>
            </thead>
            <tbody>
            {volist name="list" id="vo"}
            <tr>
                <td>{$vo.name}</td>
                <td>{$vo.study_time|timeFormat}</td>
                <td>
                    <a href="{:url('index', ['course_id' => $vo.course_id, 'ppt_file_index' => $vo.ppt_file_index, 'ppt_page' => $vo.ppt_page])}" class="mbt-bj">继续学习</a>
                    <a href="{:url('delStudyLog', ['id' => $vo.id])}" class="mbt-sc ajax-del">删除记录</a>
                </td>
            </tr>
            {/volist}
            </tbody>
        </table>

        <div id="page"></div>
    </div>

    {include file="public:footer" /}
</div>

{/block}

{block name="js"}
<script src="__STATIC__/index/js/renderPage.js"></script>
<script>
    var all_page = parseInt(`{$all_page}`);
    renderPage(all_page)

    // 搜索
    $(document).on('click', '.mbtr-btn', function () {
        var knowledge_name = $('.knowledge_name').val();
        var url = '/index/Index/studyLogList';

        if (knowledge_name) url += '/knowledge_name/' + knowledge_name;

        url += '.html';

        window.location.href = url;
    })
</script>{/block}